package fi.helsinki.cs.kaisei;

/**
 * @author Team TA's
 */

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;

import fi.helsinki.cs.kaisei.Weekday.Day;

public class Timetable implements Serializable {
	
    /**
	 * 
	 */
	private static final long serialVersionUID = 2864195101036653797L;
	private int startWeek;
    private int endWeek;
    private HashMap<Day, ArrayList<Event>> schedule;
     
    public Timetable(int startWeek, int endWeek) {
        if (startWeek < 1 || startWeek > 52 || endWeek < 1 || endWeek > 52)
            throw new IllegalArgumentException("Week numbers must be between 1-52");
        
        this.schedule = new HashMap<Day, ArrayList<Event>>();
        for(int i = 1; i <= 7; ++i)
       	this.schedule.put(Weekday.intToEnumMap.get(i),new ArrayList<Event>());
        this.startWeek = startWeek;
        this.endWeek = endWeek;
    }         

    // GETTERS AND SETTERS
   
    public void setSchedule(HashMap<Day, ArrayList<Event>> newSchedule) {
        this.schedule = newSchedule;
    }

    public HashMap<Day, ArrayList<Event>> getSchedule() {
        return this.schedule;
    }
    
    public int getStartWeek() {
    	return this.startWeek;
    }
    
    public int getEndWeek() {
    	return this.endWeek;
    }
   
    // OTHER
    public void addEvent(Day eventDay, Event event) {
    	this.schedule.get(eventDay).add(event);
    }

}

